﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Student1
    {
        public int no { get; set; }
        public string name { get; set; }
        public string sex { get; set; }
        public int age;
        public string zyxx { get; set; }

        public Student1(int no, string name, string sex, int age, string zyxx)
        {
            this.no = no;
            this.name = name;
            this.sex = sex;
            this.Age = age;
            this.zyxx = zyxx;
        }


        public int Age 
        {
            get { return age; }
            set {
                if (value<0 || value>128)
                {
                    age = 0;
                }
                else
                {
                    age = value;
                }
            }
        }
        public void stu()
        {
            Console.WriteLine("学号{0},姓名{1},性别{2},年龄{3},专业信息{4}",no,name,sex,Age,zyxx);
        }
    }
}
